package training_process.TrainingIV;

/**
 * Author by KyrieC
 * Created by sheting on 2023/11/21
 */
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class ExerciseSheet {
    private List<Exercise> exercises;

    public ExerciseSheet(int numExercises) {
        exercises = new ArrayList<>();

        Random random = new Random();

        for (int i = 0; i < numExercises; i++) {
            BinaryOperation binaryOperation;
            int operand1 = random.nextInt(100) + 1;
            int operand2 = random.nextInt(100 - operand1) + 1;

            if (random.nextBoolean()) {
                binaryOperation = new Addition(operand1, operand2);
            } else {
                binaryOperation = new Subtraction(operand1, operand2);
            }

            exercises.add(new Exercise(binaryOperation));
        }
    }

    public List<Exercise> getExercises() {
        return exercises;
    }
}

